package org.ash.consumer.controller;

import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class ConsumerController {
    @Resource
    private RestTemplate restTemplate;

    @Value("${service-url.nacos-provider-service}")
    private String serverURL;

    @GetMapping("/consumer/test/{message}")
    public String test(@PathVariable("message") String message)
    {
        String result = restTemplate.getForObject(serverURL + "/provider/test/" + message, String.class);
        return "服务消费者调用返回--" + result;
    }
}
